const express = require("express");
const path = require("path");
const axios = require("axios");

let app = express();
app.get("/",(req,res)=>{
    res.sendFile(path.join(__dirname,"./views/index.html") );
})

// nodejs 通过axios 代理转发 请求；
app.get("/getdata",async (req,res)=>{
   let {data}=await axios({
        url:"http://localhost:4000/getdata"
    })
    console.log(data,"3000data");
    res.json(data);
})

app.listen(3000,function(){
    console.log("3000服务器启动");
});